// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.modules.dao.impl;

import com.liuxinlong.modules.dao.AssetsInvestmentDao;
import com.liuxinlong.modules.entity.AssetsInvestment;
import com.liuxinlong.modules.mapper.AssetsInvestmentMapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * AssetsInvestmentDaoImpl
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2024年09月05日
 */
@Service
public class AssetsInvestmentDaoImpl extends ServiceImpl<AssetsInvestmentMapper, AssetsInvestment> implements AssetsInvestmentDao {

    @Override
    public List<AssetsInvestment> pageAssetsInvestmentInfo(Map<String, Object> queryParam) {
        return baseMapper.pageAssetsInvestmentInfo(queryParam);
    }

    @Override
    public int getAssetsInvestmentInfoCount(Map<String, Object> queryParam) {
        return baseMapper.getAssetsInvestmentInfoCount(queryParam);
    }

    @Override
    public List<AssetsInvestment> getAssetsInvestmentList(Map<String, Object> queryParam) {
        return new ArrayList<>();
    }

    @Override
    public Map<String, Map<String, String>> getAssetsInvestmentMap() {
        return baseMapper.getAssetsInvestmentMap();
    }

    @Override
    public Map<String, Map<String, String>> getAssetsInvestmentMapBySn() {
//        List<AssetsInvestment> departmentList = baseMapper.getAssetsInvestmentList();
//        Map<String, Map<String, String>> resultMap = new HashMap<>();
//        for (AssetsInvestment dep: departmentList) {
//            Map<String, String> item = ObjectUtils.object2MapString(dep);
//            if (dep.getDepartmentSn().contains(",")) {
//                List<String> snList = Arrays.asList(dep.getDepartmentSn().split(","));
//                for (String sn: snList) {
//                    resultMap.put(sn,item);
//                }
//            } else {
//                resultMap.put(dep.getDepartmentSn(),item);
//            }
//        }
//        return resultMap;
        return baseMapper.getAssetsInvestmentMapBySn();
    }

}
